# This is a sample Python script.
import json
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.


import os


def get_files_in_directory(directory):
    files = []
    for filename in os.listdir(directory):
        filepath = os.path.join(directory, filename)
        if os.path.isfile(filepath):
            txt_point=''
            with open(filepath, "r") as file_str:
                json_data = json.load(file_str)
                shapes =json_data["shapes"]
                point =shapes[0]["points"]
                for po in point:
                    print(po[1])
                #txt_point = point[0][0]+' ' +point[0][1] + '' + point[0][2] + '' + point[0][3]
                #print(point[0][2])


    #return files


# 例子用法：
directory = "D:\\data\\train_data\\yolo\\id_card\\train\\labels"  # 替换为目标目录的路径
files = get_files_in_directory(directory)
print(files)


# Press the green button in the gutter to run the script.
# if __name__ == '__main__':
#
#     get_files_in_directory('PyCharm')

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
